* Fix output of wfSajaxSearch
* (bug 12413) meta=userinfo missing <query> tag
* Add list of sections to action=parse output
+* Added action=logout
=== Languages updated in 1.12 ===
'ApiFormatYaml' => 'includes/api/ApiFormatYaml.php',
'ApiHelp' => 'includes/api/ApiHelp.php',
'ApiLogin' => 'includes/api/ApiLogin.php',
+ 'ApiLogout' => 'includes/api/ApiLogout.php',
'ApiMain' => 'includes/api/ApiMain.php',
'ApiOpenSearch' => 'includes/api/ApiOpenSearch.php',
'ApiPageSet' => 'includes/api/ApiPageSet.php',
function wfSpecialUserlogout() {
global $wgUser, $wgOut;
- if (wfRunHooks('UserLogout', array(&$wgUser))) {
-
- $wgUser->logout();
-
- wfRunHooks('UserLogoutComplete', array(&$wgUser));
-
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
- $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
- $wgOut->returnToMain();
-
- }
+ $wgUser->logout();
+ $wgOut->setRobotpolicy( 'noindex,nofollow' );
+ $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
+ $wgOut->returnToMain();
}
}
/**
- * Logout user
- * Clears the cookies and session, resets the instance cache
+ * Logout user.
*/
function logout() {
+ if( wfRunHooks( 'UserLogout', array(&$this) ) ) {
+ $this->doLogout();
+ wfRunHooks( 'UserLogoutComplete', array(&$wgUser) );
+ }
+ }
+
+ /**
+ * Really logout user
+ * Clears the cookies and session, resets the instance cache
+ */
+ function doLogout() {
global $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookiePrefix;
$this->clearInstanceCache( 'defaults' );
--- /dev/null
+<?php
+
+/*
+ * Created on Jan 4, 2008
+ *
+ * API for MediaWiki 1.8+
+ *
+ * Copyright (C) 2008 Yuri Astrakhan <Firstname><Lastname>@gmail.com,
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+if (!defined('MEDIAWIKI')) {
+ // Eclipse helper - will be ignored in production
+ require_once ('ApiBase.php');
+}
+
+class ApiLogout extends ApiBase {
+
+ public function __construct($main, $action) {
+ parent :: __construct($main, $action, 'lo');
+ }
+
+ public function execute() {
+ global $wgUser;
+ $wgUser->logout();
+ }
+
+ protected function getAllowedParams() {
+ return array ();
+ }
+
+ protected function getParamDescription() {
+ return array ();
+ }
+
+ protected function getDescription() {
+ return array (
+ 'This module is used to logout and clear session data'
+ );
+ }
+
+ protected function getExamples() {
+ return array(
+ 'api.php?action=logout'
+ );
+ }
+
+ public function getVersion() {
+ return __CLASS__ . ': $Id$';
+ }
+}
\ No newline at end of file
*/
private static $Modules = array (
'login' => 'ApiLogin',
+ 'logout' => 'ApiLogout',
'query' => 'ApiQuery',
'expandtemplates' => 'ApiExpandTemplates',
'render' => 'ApiRender',
global $wgUser;
if (!$wgUser->isAllowed('read')) {
self::$Modules = array(
- 'login' => self::$Modules['login'],
- 'help' => self::$Modules['help']
+ 'login' => self::$Modules['login'],
+ 'logout' => self::$Modules['logout'],
+ 'help' => self::$Modules['help'],
);
}
}
* Execute the actual module, without any error handling
*/
protected function executeAction() {
-
+
$params = $this->extractRequestParams();
-
+
$this->mShowVersions = $params['version'];
$this->mAction = $params['action'];
$messages_out[] = $message;
}
$result->setIndexedTagName( $messages_out, 'message' );
- $result->addValue( null, $this->getModuleName(), $messages_out );
+ $result->addValue( 'query', $this->getModuleName(), $messages_out );
}
protected function getAllowedParams() {